<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>WebUploader演示</title>
    <link rel="stylesheet" type="text/css" href="res/style.css" />
</head>
<body>
    选择上传文件：<input type="file" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/res/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/res/jquery.ajaxfileupload.js"></script>
<script type="text/javascript">
    $('input[type="file"]').ajaxfileupload({
        'action': '${pageContext.request.contextPath}/upload',
        'onComplete': function(response) {
            console.log('custom handler for file:');
            alert("success");
        },
//        'onStart': function() {
//            if(weWantedTo) return false; // cancels upload
//        },
        'onCancel': function() {
            console.log('no file selected');
        }
    });
</script>
</body>
</html>